#include "coin2/exchange/base/market/enums.h"
#include "coin2/exchange/base/symbology/product_holder_manager.h"
#include "coin2/exchange/base/symbology/util.h"
#include "coin2/exchange/factory/symbology/product.h"

using ExchangeType = coin2::exchange::base::market::ExchangeType;
using MarketType = coin2::exchange::base::market::MarketType;
;
using coin::proto::ProductHolderManagerConfig;
using coin2::exchange::base::symbology::ProductHolderManager;
using coin2::exchange::base::symbology::ProductInfoConstantsManager;
using MarketExchangeApi = coin2::exchange::base::market::MarketExchangeApi;

int main() {
  ProductHolderManagerConfig config;

  ProductHolderManager product_manager(config);

  int64_t timestamp = 1691366400000000000;  // 2023-08-07T00:00:00Z

  product_manager.GetMutableProductInfoConstantsManager()->GetProductInfoConstant(
      MarketType::Futures, ExchangeType::Prex, timestamp);

  auto mea = MarketExchangeApi::FromString("Futures.Prex.v1");
  auto product = CreateProductFromNormString(mea, std::string("YGG-USDT.PERPETUAL"), timestamp);

  auto product_holder = product_manager.GetProductHolder(*product, timestamp);
  std::cout << product->native_symbol() << std::endl;
  std::cout << product_holder->product().relative_norm() << std::endl;
  std::cout << product_holder->product_info().contract_value() << std::endl;
  return 0;
}

